<%--
  Created by IntelliJ IDEA.
  User: 15656
  Date: 2020/5/19
  Time: 11:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div class="xhq-caigou-add">
    <!-- row1 - 新增按钮和删除按钮 -->
    <div class="row align-items-center" style="margin: 15px 0 0 0;">
        <b class="input-group-text border-0 p-md-0 col-auto align-self-center" style="position: relative; top: -7px; font-weight: 700;">
            <span style="color: red; margin-right: 5px;">*</span>
            供应商：
        </b>

        <!-- 供应商类型选择框 -->
        <div class="input-group col-2 align-self-center"

             data-original-title=""
             data-animation="true"
             data-placement="top"
             data-toggle="tooltip"
             data-trigger="focus">

            <select class="custom-select form-control cgdd-gys-add">
                <option selected>请选择供应商</option>
            </select>
        </div>

        <!--加加按钮-->
        <div class="col-auto">
            <a href="JavaScript:;" onclick="jiajiaGYG(this)" class="fa icon-plus p-md-0" style="font-size: 20px; position: relative; top: -4px; left: -30px; color: #1CBCD8; margin: 0 15px;"></a>
        </div>

        <b class="input-group-text border-0 p-md-0 col-auto align-self-center"
           style="position: relative; top: -7px; font-weight: 700;">
            采购备注：
        </b>

        <div class="input-group col-2">
            <input class="form-control" type="" name="" id="cgdd-xzcg-bz" value="" placeholder="请输入采购备注" />
        </div>

        <div class="col"></div>

        <div class="col-5 row justify-content-end">
            <button class="col-2 btn btn-primary float-right" id="cgdd-addWP" type="button"
                    data-toggle="modal" data-target="#cgdd-addMode">
                添加物品
            </button>
        </div>
    </div>

    <div class="">
        <div class="row">
            <div class="col">
                <div id="caigoudingdan-table1">
                </div>
            </div>
        </div>
    </div>


    <section>
        <div class="row">
            <div class="col-sm-12">
                <div class="card">
                    <div class="card-header">
                        <h4 class="card-title">
                            <%--表格标题--%>
                        </h4>
                    </div>
                    <div class="card-content">
                        <div class="card-body">
                            <table class="table table-responsive-md text-center">
                                <thead>
                                <tr class="xhq-table-color">
                                    <th>编号</th>
                                    <th>物品展示</th>
                                    <th>采购物品</th>
                                    <th>物品ID</th>
                                    <th>计量单位</th>
                                    <th>采购单价</th>
                                    <th>数量</th>
                                    <th>金额小计(元)</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>

                                </tbody>
                            </table>

                        </div>

                    </div>

                    <div class="card-footer border-0">
                        <div class="row m-0 justify-content-end ">

                            <div class="col-5 row justify-content-end">

                                <button class="col-2 btn btn-primary mr-3 float-right" data-xhq="cgddUpdata-baoCun" type="button">
                                    保存
                                </button>

                                <button class="col-2 btn btn-danger float-right" data-xhq="cgddUpdata-tiJiao" type="button" >
                                    提交
                                </button>

                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!--Shopping cart ends-->


    <!--模态框-->
    <div class="modal fade text-center" style="" id="cgdd-addMode"
         tabindex="-1" data-backdrop="static" role="dialog"
         aria-labelledby="exampleModalLabel" aria-hidden="true">

        <div class="modal-dialog" role="document"
             style="top: 25px; left: -100px;">
            <div class="modal-content container card" style="width: 800px; margin: 0 auto;">

                <div class="modal-header" style="">
                    <p style="margin: 0 auto; font-weight: 700; font-size: 18px;">选择采购物品</p>
                    <a class="close position-absolute"
                       data-dismiss="modal" onclick="" aria-label="Close"
                       style="right: 20px;">
                        <span aria-hidden="false">&times;</span>
                    </a>
                </div>

                <div class="modal-body" style="padding: 30px 15px; padding-bottom: 0px;">

                    <div class="row">
                        <select class="cgdd-gys-add col-3 mr-md-3 custom-select form-control" id="cgdd-gys">
                            <option selected>请选择供应商</option>
                        </select>
                        <input class="col-3 mr-md-3 form-control" type=""
                               name="" value="" placeholder="请输入物品ID" />
                        <input class="col-3 mr-md-3 form-control" type=""
                               name="" value="" placeholder="请输入物品品名" />
                    </div>

                    <div class="row" style="margin-top:10px;">
                        <select class="col-3 mr-md-3 custom-select form-control align-self-center" id="cgdd-gys">
                            <option selected>请选择物品分类</option>
                        </select>

                        <div class="col row justify-content-start">
                            <button class="col-2 position-relative btn btn-primary align-self-center"
                                    data-original-title="刷新页面时会重置之前的勾选"
                                    data-animation="true"
                                    data-placement="right"
                                    data-toggle="tooltip"
                                    data-trigger="hover"
                                    id="cgdd-tjwp-select" type="button" data-toggle="" data-target=""
                                    style="top: 8px; margin-right: 60px;">
                                查询
                            </button>
                        </div>
                    </div>

                    <!--表格的行-->
                    <div class="row">
                        <div class="col " id="cgdd-tjwu-table2" style="padding: 0;">
                        </div>
                    </div>

                    <section id="extended">
                        <div class="row">
                            <div class="col-sm-12 p-0">
                                <div class="card">
                                    <div class="card-content">
                                        <div class="card-body table-responsive">
                                            <table class="table text-center">
                                                <thead>
                                                <tr>
                                                    <th>
                                                        <div class="custom-control custom-checkbox m-0">
                                                            <input type="checkbox" class="custom-control-input" id="item1">
                                                            <label class="custom-control-label" for="item1"></label>
                                                        </div>
                                                    </th>
                                                    <th>供应商名称</th>
                                                    <th>物品ID</th>
                                                    <th>物品品名</th>
                                                    <th>物品分类</th>
                                                    <th>计量单位</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <tr>
                                                    <td>
                                                        <div class="custom-control custom-checkbox m-0">
                                                            <input type="checkbox" class="custom-control-input" id="item1">
                                                            <label class="custom-control-label" for="item1"></label>
                                                        </div>
                                                    </td>
                                                    <td>
                                                        华东批发市场
                                                    </td>
                                                    <td>
                                                        1
                                                    </td>
                                                    <td>牛仔夹克</td>
                                                    <td>服饰</td>
                                                    <td>件</td>
                                                </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
                    <!--Extended Table Ends-->


                </div>



                <div class="modal-footer row justify-content-center">
                    <div class="col">
                        <button class="col-2 btn btn-primary"
                                id="cgdd-tjwp-tijiao"
                                type="button" data-dismiss="modal" data-toggle="" data-target=""
                                style="margin-left: 20px; height: 37px;">
                            提交
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="${pageContext.request.contextPath}/app-assets/js/tooltip.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/app-assets/js/components-modal.min.js" type="text/javascript"></script>

<script>

    (function () {
        let orderNo = '${orderNo}';

        $('[data-xhq="cgddUpdata-baoCun"]').on("click",function () {
            console.log("点击了保存");
            $(this).returnMianbao();
        });
        $('[data-xhq="cgddUpdata-tiJiao"]').on("click",function () {
            console.log("点击了提交");
            swal({
                title: '是否确认要提交该订单?',
                text: "【"+orderNo+"】",
                type: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#0CC27E',
                cancelButtonColor: '#FF586B',
                confirmButtonText: '提交',
                cancelButtonText: "取消"
            }).then(
                function (isConfirm) {
                    //删除订单
                    if (isConfirm) {

                        // 以 post 方式发送请求给 servlet
                        $.post('xhqCgddUpdata',{orderNo : orderNo},function (res) {
                            if(res.code == '200'){
                                swal(
                                    '订单提交操作成功!',
                                    '',
                                    'success'
                                );
                                $(this).returnMianbao();
                                $('#refreshThisNav').trigger('click');
                            }else{
                                swal(
                                    '订单提交操作失败!',
                                    '',
                                    'error'
                                );
                            }
                        },'json');


                    }
                }).catch(swal.noop);




        });
    })();


</script>


